package ioc

import "fmt"

func (app *Container) SetService(obj IocObj) {
	if _, ok := app.services[obj.Name()]; ok {
		panic(fmt.Sprintf("service already exit: %s", obj.Name()))
	}
	app.services[obj.Name()] = obj
}
func (app *Container) GetService(name string) IocObj {
	v, ok := app.services[name]
	if !ok {
		panic(fmt.Sprintf("service not found: %s", name))
	}
	return v
}
